﻿namespace Uber.WebUI.Controllers
{
    using System.Web.Mvc;
    using Core.Security;

    public class UberAccountController : Controller
    {
        private readonly IFormsAuthentication formsAuth;

        public UberAccountController(IFormsAuthentication formsAuth)
        {
            this.formsAuth = formsAuth;
        }

        public ActionResult LogOn()
        {
            return View();
        }

        [HttpPost]
        public ActionResult LogOn(string userName, string password)
        {
            if (userName == "furious" && password == "1" )
            {
                formsAuth.SignIn(userName, false, "admin");
                return RedirectToAction("Index", "FillPayRequest");
            }

            ModelState.AddModelError("_FORM", "Login or Password not correct, please try againg");
            return View();
        }
    }
}